package lx9_UDP小案例;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.util.Arrays;

public class Receive {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(8090);
        DatagramPacket dp = new DatagramPacket(new byte[1024],1024);
        //
        while(true){
            ds.receive(dp);
            String s = new String(dp.getData(),0,dp.getLength());
            System.out.println(s);
            if("886".equals(s))break;
        }
        ds.close();
    }
}
